{% extends "foodsnroses/base.html" %}
{% comment %}
<!--
  Copyright (C) 2008 ZHENG Zhong <http://www.zhengzhong.net/>

  Created on 2008-08-15.
  $Id$
-->
{% endcomment %}

{#________________________________________________________________________________________________#}

{% block html_head %}

<title>{{resto.names|escape}} :: Foods N' Roses</title>
<link rel="stylesheet" type="text/css" media="screen,print" href="{{static_}}/css/form.css"/>
<link rel="stylesheet" type="text/css" media="screen,print" href="{{static_}}/css/resto.css"/>

<script type="text/javascript">//<![CDATA[

  function toggleBox(boxId) {
    $(boxId + " .view").toggle("slow");
    $(boxId + " .edit").toggle("slow");
  }
  
  //! Submits an AJAX form.
  function submitAjaxForm(boxId, formId) {
    // Select the AJAX form by ID.
    var form = $(formId);
    // Prepare AJAX options.
    var options = {
      type: form.attr("method"),
      url: form.attr("action"),
      data: form.serialize(),
      success: function(data) {
        // Replace the original AJAX box by the new one received from the server.
        $(boxId).after(data).remove();
      },
      error: function(xhr, status, exc) {
        // We are still in the original AJAX box: enable AJAX form and show AJAX error.
        $(":button", form).removeAttr("disabled");
        $(".ajax_indicator", form).hide();
        var ajax_error = $(boxId + " .ajax_error");
        ajax_error.text("Server failed to handle the AJAX request.");
        ajax_error.show();
      }
    };
    // Before submitting AJAX form, disable AJAX form and hide previous AJAX error.
    $(":button", form).attr("disabled", "disabled");
    $(".ajax_indicator", form).show();
    $(boxId + " .ajax_error").hide();
    // Submit the AJAX form, leave the rest to the AJAX callback functions.
    $.ajax(options);
    // Return false, to disable default submit event.
    return false;
  }

//]]></script>

{% endblock %}{# html_head #}

{#________________________________________________________________________________________________#}

{% block navbar %}

<a href="{{webapp_}}/restos/">Resto catalog</a> &#187;
<b>{{resto.names|escape}}</b>

{% endblock %}

{#________________________________________________________________________________________________#}

{% block content %}

<div id="resto">

  <!-- On top ___________________________________________________________________________________-->
  
  <div id="on_top">
    {% include "foodsnroses/ajax/resto_names.html" %}
    {% include "foodsnroses/ajax/resto_address.html" %}
  </div><!--/#on_top-->
  
  <!-- On left __________________________________________________________________________________-->
  
  <div id="on_left">
    {% include "foodsnroses/ajax/resto_photo.html" %}
    {% include "foodsnroses/ajax/resto_ratings.html" %}
    {% include "foodsnroses/ajax/resto_description.html" %}
    {% include "foodsnroses/ajax/resto_map.html" %}
  </div><!--/#on_left-->
  
  <!-- On right _________________________________________________________________________________-->
  
  <div id="on_right">
    {% include "foodsnroses/ajax/resto_contact.html" %}
    {% include "foodsnroses/ajax/resto_tags.html" %}
    {% include "foodsnroses/ajax/resto_best_dishes.html" %}
  </div><!--/#on_right-->
  
  <div class="clear"></div>
  
  <div id="on_bottom">
    {% include "foodsnroses/ajax/resto_comments_proxy.html" %}
  </div><!--/#on_bottom-->
  
  <div id="footer">
    The information on this resto was contributed by <b>{{resto.submitter.nickname}}</b>
    on {{resto.submit_date|date:"Y-m-d"}}.
    <br/>
    Link to this page: <a href="{{path_}}">{{server_url_}}{{path_}}</a>
  </div><!--/#footer-->

</div><!--/#resto-->

{% endblock %}{# content #}



